bugfix: Index properly when dependencyModules is empty - #8787
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe indexer now falls back to target classpath jars when dependency modules are absent or empty. It associates source jars, derives Scala dialects, and adds dependency modules. Build server capability reporting and Bill test support were updated. Tests verify Scala library definition lookup. ChangesDependency module fallback
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant BuildServerConnection
participant Bill
participant Indexer
participant DefinitionIndex
BuildServerConnection-->>Indexer: dependency-modules capability
Bill-->>Indexer: empty dependency-module result
Indexer->>Indexer: read and deduplicate classpath jars
Indexer->>DefinitionIndex: index fallback jars
DefinitionIndex-->>Indexer: resolve Scala List definition
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@metals/src/main/scala/scala/meta/internal/metals/Indexer.scala`:
- Around line 268-278: Update the dependency indexing flow in Indexer to retain
the set returned by indexDependencyModules and trigger
indexClasspathJarsFallback when that set is empty, rather than checking only
dependencyModules target items. Preserve the isClasspathIndexing guard, and add
a regression case covering a nonempty DependencyModulesResult whose module lists
are empty.
In `@tests/unit/src/main/scala/bill/Bill.scala`:
- Around line 404-410: Update buildInitialize to call
capabilities.setDependencyModulesProvider(true), so BuildServerConnection
advertises and routes dependency-module requests to
Bill.buildTargetDependencyModules instead of returning its local empty result.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 57d2ee77-fb08-4fc3-93c7-a5af81616337
📒 Files selected for processing (4)
metals/src/main/scala/scala/meta/internal/metals/Indexer.scalametals/src/main/scala/scala/meta/internal/metals/buildserver/BuildServerConnection.scalatests/unit/src/main/scala/bill/Bill.scalatests/unit/src/test/scala/tests/BillLspSuite.scala
6d52eab to
3e4da1f
Compare
There were two issues here, which together broke go to def for dependency sources in Scala CLI: - we had a check to not run the request for Scala CLI (due to some previous native image issues) - without dependency modules nothing would be indexed Now, we remove the workaround as the Scala CLI issue is now solved, but also added a fallback just in case
3e4da1f to
bef83a5
Compare
There were two issues here, which together broke go to def for dependency sources in Scala CLI:
Now, we remove the workaround as the Scala CLI issue is now solved, but also added a fallback just in case
Summary by CodeRabbit